import Vue from 'vue';
import VueRouter from 'vue-router'

const Person = () => import('../views/mine/person')
const Home = () => import('../views/home/home')
const Category = () => import('../views/class/category')
const ShopCar = () => import('../views/shopcar/shopcar')
const Detail = () => import('../views/detail/Detail')
//安装插件
Vue.use(VueRouter);

//创建router
const routes = [
  {
    path: '',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    path: '/category',
    component: Category
  },
  {
    path: '/shopcar',
    component: ShopCar
  },
  {
    path: '/person',
    component: Person
  },
  {
    path: '/detail/:iid',//动态路由传递id参数
    component: Detail
  }
]


const router = new VueRouter({
  routes,
  mode: 'history'
})

//导出
export default router